class PackageStream:

    def __init__(this):
        this.io = bytearray()

    def write(this, b):
        if isinstance(b, int):
            b = bytes([b])
        this.io.extend(b)

    def len(this):
        return len(this.io)

    def clear(this):
        this.io.clear()

    def get(this):
        return bytes(this.io)
